package cn.com.cetccst.appstore.network;

import com.google.gson.JsonObject;

import java.util.Map;

import cn.com.cetccst.appstore.network.response.AppListResponse;
import cn.com.cetccst.appstore.network.response.CategoryListResponse;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;


public interface IAppStoreApiService {

    @POST("/mam/api/appstore/notification/registration")
    Call<ResponseBody> registerNcm(@Body RequestBody requestBody);

    @GET("/mam/api/appstore/apps")
    Call<AppListResponse> getAllApps(@QueryMap Map<String, String> queryMap);

    @GET("/mam/api/appstore/apps/categories")
    Call<CategoryListResponse> getCategoryNameByCategoryId(@QueryMap Map<String, String> queryMap);

    @GET("/mam/api/appstore/apps/{app_id}")
    Call<JsonObject> getAppDetail(@Path("app_id") String appId);

    @GET("/mam/api/appstore/apps/app/app_id_string")
    Call<JsonObject> getAppDetailByPackageName(@Query("query") String packageName);

    @GET("/mam/api/appstore/apps/publishers/{publisher_id}")
    Call<JsonObject> getPublisher(@Path("publisher_id") String publisherId);

    @Streaming
    @GET
    Call<ResponseBody> downloadFile(@Url String url, @Header("Range") String range);

    @GET("/mam/api/appstore/apps/{app_id}/downloaded")
    Call<Void> notifyAppDownloaded(@Path("app_id") String id);

}
